package io.kiki.stack.netty.serialization;

import io.kiki.stack.netty.command.RequestCommand;
import io.kiki.stack.netty.command.ResponseCommand;
import io.kiki.stack.netty.exception.DeserializationException;
import io.kiki.stack.netty.exception.SerializationException;
import io.kiki.stack.netty.invoker.RequestContext;

public interface CustomSerializer {

    <T extends RequestCommand> boolean serializeHeader(T request, RequestContext requestContext) throws SerializationException;

    <T extends ResponseCommand> boolean serializeHeader(T response) throws SerializationException;

    <T extends RequestCommand> boolean deserializeHeader(T request) throws DeserializationException;

    <T extends ResponseCommand> boolean deserializeHeader(T response, RequestContext requestContext) throws DeserializationException;

    <T extends RequestCommand> boolean serializeContent(T request, RequestContext requestContext) throws SerializationException;

    <T extends ResponseCommand> boolean serializeContent(T response) throws SerializationException;

    <T extends RequestCommand> boolean deserializeContent(T request) throws DeserializationException;

    <T extends ResponseCommand> boolean deserializeContent(T response, RequestContext requestContext) throws DeserializationException;
}